<?php
/**
 * Created by PhpStorm.
 * User: meiyun1
 * Date: 2017/3/8
 * Time: 下午5:53
 */

namespace App\Models\ActivityPrize;

class ActivityPrizeRepository implements \App\Contracts\Repositories\ActivityPrizeRepository
{
    public function create(ActivityPrize $activityPrize)
    {
        // TODO: Implement create() method.
        if ($activityPrize->save()) {
            return $activityPrize;
        }
        return null;
    }

    public function destroy($ids)
    {
        // TODO: Implement destroy() method.
        return ActivityPrize::destroy($ids);
    }

    public function deleteByConditions($conditions)
    {
        // TODO: Implement deleteByConditions() method.

        return ActivityPrize::query()->where($conditions)->delete();
    }

    public function findListByConditions($conditions)
    {
        // TODO: Implement findListByConditions() method.

        return ActivityPrize::query()->where($conditions)->get();
    }

    public function update($params=[],$conditions)
    {
        return ActivityPrize::where($conditions)->update($params);
    }
    public function findOneByPrizeID($prize_id){
        return ActivityPrize::query()->where('prize_id',$prize_id)->count();
    }
}
